package com.harmony.pilot.knowledge.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/api")
public class HealthController {
    
    @GetMapping("/health")
    public Map<String, Object> health() {
        Map<String, Object> response = new HashMap<>();
        response.put("status", "UP");
        response.put("service", "OpenHarmony Knowledge Service");
        response.put("version", "1.0.0");
        response.put("time", LocalDateTime.now());
        response.put("database", "H2 (Embedded)");
        response.put("features", new String[]{
            "代码扫描", 
            "代码补全", 
            "调用链分析（1-999层）", 
            "跨仓依赖识别"
        });
        return response;
    }
    
    @GetMapping("/info")
    public Map<String, Object> info() {
        Map<String, Object> response = new HashMap<>();
        response.put("name", "OpenHarmony Knowledge Service");
        response.put("description", "OpenHarmony代码知识库服务 - RAG for LLM");
        response.put("port", 8087);
        response.put("docs", Map.of(
            "快速开始", "docs/guides/QUICK_START.md",
            "存储方案", "docs/STORAGE_SUMMARY.md",
            "调用链功能", "docs/CALL_CHAIN_SUMMARY.md",
            "任意深度支持", "FLEXIBLE_DEPTH_SUMMARY.md"
        ));
        return response;
    }
}

